<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function valueAtBit(num, bit) {
      // console.log(parseInt(num,2));
      num = num.toString(2).split('').reverse()
      console.log(num);
      return num[bit-1]
    }
      // 转化二进制
    console.log(valueAtBit(100, 5));
  </script>
</body>

</html>